<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="按钮" onclick="fn1()">
<script>
    //无参无返回值
    function fn1() {
        alert("fn1")
    }

    //调用方法
    //fn1();
    //2.有参无返回值
    function fn2(name, age) {
        alert(name + ":" + age);
    }

    //fn2("刘备",18);
    //无参有返回值
    function fn3() {
        return "这是返回值"
    }

    /*let info=fn3();
    alert(info)*/
    //有参有返回值
    function fn4(x, y) {
        return x * y;
    }

    // let result = fn4(4, 9);
    // alert(result);
    //第二种方式
    let fn5=function (name,age) {
        alert(name+":"+age);
    }
    //fn5("关羽",33);

    //第三种方法
    let  fn6=new Function ("name","age","alert(name+':'+age)") ;
    //fn6("张飞",50);
</script>
</body>
</html>